package 课程设计报告_hb_6_30;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;


/**
 * @author Jiang Zhiyan
 *
 * 2021年6月30日 下午3:15:16
 *
 */
public class Apple {
//	颜色
	private String color;
	// 重量
	private int weight;
	// 产地
	private String location;
	@Override
    public int hashCode() {
    	return this.color.hashCode()+ this.weight + this.location.hashCode();
    }
	
	@Override
//	重写equals方法
	public boolean equals(Object obj) {
		if(obj == null) return false;
		if(obj == this) return true;
		if(obj instanceof Apple) {
			Apple other =(Apple) obj;
			return this.color.equals(other.color) && this.weight == other.weight
		        && this.location.equals(other.location);			
		}
		return false;
	}
	/**
	 * 
	 */
	public Apple() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @param color
	 * @param weight
	 * @param location
	 */
	public Apple(String color, int weight, String location) {
		super();
		this.color = color;
		this.weight = weight;
		this.location = location;
	}

	/**
	 * @return the color
	 */
	public String getColor() {
		return color;
	}

	/**
	 * @param color the color to set
	 */
	public void setColor(String color) {
		this.color = color;
	}

	/**
	 * @return the weight
	 */
	public int getWeight() {
		return weight;
	}

	/**
	 * @param weight the weight to set
	 */
	public void setWeight(int weight) {
		this.weight = weight;
	}

	/**
	 * @return the location
	 */
	public String getLocation() {
		return location;
	}

	/**
	 * @param location the location to set
	 */
	public void setLocation(String location) {
		this.location = location;
	}
}
